/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.classdiagram.tabbedproperties.filters;

import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Transition;

import com.cea.papyrus.core.tabbedproperties.UMLElementFilter;

/**
 * The Class VisibilitySectionFilter.
 * 
 * @author Gilles Cannenterre
 */
public class VisibilitySectionFilter extends UMLElementFilter {

    /**
     * {@inheritDoc}
     */
	public boolean select(Object object) {
    	/*
    	 * if the current element is a Port, the visibility section is not shown because 
    	 * it is said in the UML2 specification: "A port by default has public visibility.
    	 *  However, a behavior port may be hidden but does not have to be."
    	 *  If the user wants to specify a visibility other than public, (s)he can use
    	 *  the advanced tab of the property view.
    	 *  if the current element is a Transiton, the visibility section is not shown 
    	 *  in the general tab of the property view because not very often used. User can use the
    	 *   the advanced tab of the property view if required.
    	*/
    	if ((super.select(object)) 	&& (element instanceof NamedElement) 
    								&& !(element instanceof Port)
    								&& !(element instanceof Transition)) { 
    			return true;
    		}     	
    	return false;
    }
}


